package com.tplan.tplanexternalserver.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.tplan.domain.Company;
import com.tplan.tplanexternalserver.controller.service.CompanyService;
import com.tplan.util.GsonUtil;

@RestController
@RequestMapping(value = "company")
public class CompanyController {

    @Autowired
    CompanyService companyService;

    @GetMapping("/get")
    @ResponseBody
    public String getCompanyById(@RequestParam("id") int id) {

        Company company = companyService.getCompanyById(id);

        return GsonUtil.ObjectToGson(company);

    }

}
